package com.youyun56.gps.schedual;

public class MessageAnalysis {

    private final static char chr3 = 3;

    public static Boolean loginSuccess(String str) {
        return str.charAt(4) == '1' ? true : false;
    }

    public static String[] infos(String str) {
        return str.split(String.valueOf(chr3));

    }

    public static String line(StringBuffer sb) {
        int begin = sb.indexOf(GPSFactory.line);
        if (begin != -1) {
            int end = begin + GPSFactory.line.length();
            String line = sb.substring(0, end);
            sb.delete(0, end);
            return line;
        } else {
            return null;
        }
    }

    public static void main(String[] args) {
//		String msg = "901016133139117282011-09-13 12:28:030118.326553344727.0468750.00.00";
//		String[] infos = MessageAnalysis.infos(msg);
//		for(String str : infos){
//			System.out.println(str);
//		}
        StringBuffer sb = new StringBuffer();
        sb.append("aaa");
        sb.append(GPSFactory.line);
        sb.append("bbb");
        sb.append(GPSFactory.line);
        sb.append("ccc");
        sb.append(GPSFactory.line);
        sb.append("ddd");
        String line = null;
        while ((line = MessageAnalysis.line(sb)) != null) {
            System.out.print(line);
        }
    }
}
